//
//  MKTChatLinkCVCell.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/7/9.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKTChatLinkCVCell.h"

@implementation MKTChatLinkCVCell
- (id)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        self.linkButton = [[MKTChatLinkButton alloc] init];
        [self.linkButton addTarget:self action:@selector(__onButtonDidTap:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.linkButton];
    }
    return self;
}
- (void)__onButtonDidTap:(id)sender{
    [self.collectionCellModel didClickSelf];
}
- (void)customLayoutSubviews{
    [super customLayoutSubviews];
    CGRect bounds = self.contentView.bounds;
    self.linkButton.frame = bounds;
}
- (void)customReloadCellModel{
    [super customReloadCellModel];
    MKTChatLink *link = self.collectionCellModel.modelValue;
    [self.linkButton setTitle:link.title forState:UIControlStateNormal];
}
- (CGSize)customSizeThatFits:(CGSize)size{
    return [self.linkButton sizeThatFits:size];
}
@end
